<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <!-- 1.引入vue.js文件 -->
    <script src="js/vue.js"></script>
</head>

<body>
    <!-- 声明式渲染 -->
    <div id="app">
        <p>{{num}}</p>
        <button v-on:click="num++">num++</button>
        <!-- v-on:可以简写为@ -->
        <button @click="num--">num--</button>
        <button @click="fun">获取num数据</button>
    </div>
    <!-- {{msg}} -->
    <script>
        var app = new Vue({
            // element
            // 挂载元素
            el: '#app',
            // 渲染数据定义
            data: {
                num: 10
            },
            methods: {
                fun: function() {
                    console.log(this);
                    console.log(this.num);
                }
            }
        });
    </script>
</body>

</html>